package com.xdb.sqlparser.dialect.oracle.ast.statement;

import com.xdb.sqlparser.ast.statement.SQLSelect;
import com.xdb.sqlparser.ast.statement.SQLSubqueryTableSource;
import com.xdb.sqlparser.dialect.oracle.ast.clause.OracleFlashbackQueryClause;
import com.xdb.sqlparser.dialect.oracle.visitor.OracleASTVisitor;
import com.xdb.sqlparser.util.SQLUtils;
import com.xdb.sqlparser.visitor.SQLAstVisitor;

public class OracleSelectSubqueryTableSource extends SQLSubqueryTableSource implements OracleSelectTableSource {

	protected OracleSelectPivotBase pivot;

	protected OracleFlashbackQueryClause flashback;

	public OracleSelectSubqueryTableSource() {
	}

	public OracleFlashbackQueryClause getFlashback() {
		return flashback;
	}

	public void setFlashback(OracleFlashbackQueryClause flashback) {
		this.flashback = flashback;
	}

	public OracleSelectSubqueryTableSource(String alias) {
		super(alias);
	}

	public OracleSelectSubqueryTableSource(SQLSelect select, String alias) {
		super(select, alias);
	}

	public OracleSelectSubqueryTableSource(SQLSelect select) {
		super(select);
	}

	public OracleSelectPivotBase getPivot() {
		return pivot;
	}

	public void setPivot(OracleSelectPivotBase pivot) {
		this.pivot = pivot;
	}

	@Override
	protected void accept0(SQLAstVisitor visitor) {
		this.accept0((OracleASTVisitor) visitor);
	}

	protected void accept0(OracleASTVisitor visitor) {
		if (visitor.visit(this)) {
			acceptChild(visitor, this.getHints());
			acceptChild(visitor, this.select);
			acceptChild(visitor, this.pivot);
			acceptChild(visitor, this.flashback);
		}
		visitor.endVisit(this);
	}

	public String toString() {
		return SQLUtils.toOracleString(this);
	}
}
